import { createFileRoute } from '@tanstack/react-router'
import Dashboard from '@/features/dashboard'
import { dashboard } from '@/api'

export const Route = createFileRoute('/_authenticated/')({
  component: Dashboard,
  loader: async ({ context: { queryClient } }) => {
    const res = await queryClient.ensureQueryData({
      queryKey: ['dashboard'],
      queryFn: dashboard
    })
    return res.data.data;
  }
})
